Add gtk_widget_has_rc_style() accessor
authorJavier Jardón <jjardon@gnome.org>
Mon, 18 Jan 2010 16:12:42 +0000 (17:12 +0100)
committerJavier Jardón <jjardon@gnome.org>
Mon, 18 Jan 2010 23:20:52 +0000 (00:20 +0100)
Add gtk_widget_has_rc_style() as accessor for sealed
GTK_WIDGET_RC_STYLE widget flag.

https://bugzilla.gnome.org/show_bug.cgi?id=69872

docs/reference/gtk/gtk-sections.txt
gtk/gtk.symbols
gtk/gtkwidget.c
gtk/gtkwidget.h

index 781f3d1b656bc79865154d3ce36ab94a580bbdec..1369c724ba18903d19f3472ab91ffb7301d2919c 100644 (file)
@@ -5733,6 +5733,7 @@ gtk_widget_set_visible
 gtk_widget_has_default
 gtk_widget_has_focus
 gtk_widget_has_grab
+gtk_widget_has_rc_style
 gtk_widget_is_drawable
 gtk_widget_is_toplevel
 gtk_widget_set_window
index 9176aa750d058eac05fdae82c4c6e2a5ee54a22a..2834c074df30013272ef9e814c441024e8e62b5e 100644 (file)
@@ -5132,6 +5132,7 @@ gtk_widget_grab_focus
 gtk_widget_has_default
 gtk_widget_has_focus
 gtk_widget_has_grab
+gtk_widget_has_rc_style
 gtk_widget_has_screen
 gtk_widget_hide
 gtk_widget_hide_all
index 5a4ab990a1f538f86d6ee9d658cb9b07fae5310c..3a954970f7060766dc41fa81488a1bce8d9e2544 100644 (file)
@@ -5726,7 +5726,7 @@ gtk_widget_set_name (GtkWidget     *widget,
   g_free (widget->name);
   widget->name = new_name;
 
-  if (GTK_WIDGET_RC_STYLE (widget))
+  if (gtk_widget_has_rc_style (widget))
     gtk_widget_reset_rc_style (widget);
 
   g_object_notify (G_OBJECT (widget), "name");
@@ -6293,6 +6293,25 @@ gtk_widget_get_parent (GtkWidget *widget)
  * see docs/styles.txt
  *****************************************/
 
+/**
+ * gtk_widget_has_rc_style:
+ * @widget: a #GtkWidget
+ *
+ * Determines if the widget style has been looked up through the rc mechanism.
+ *
+ * Returns: %TRUE if the widget has been looked up through the rc
+ *   mechanism, %FALSE otherwise.
+ *
+ * Since: 2.20
+ **/
+gboolean
+gtk_widget_has_rc_style (GtkWidget *widget)
+{
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+  return (GTK_WIDGET_FLAGS (widget) & GTK_RC_STYLE) != 0;
+}
+
 /**
  * gtk_widget_set_style:
  * @widget: a #GtkWidget
@@ -6314,7 +6333,7 @@ gtk_widget_set_style (GtkWidget *widget,
     {
       gboolean initial_emission;
 
-      initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
+      initial_emission = !gtk_widget_has_rc_style (widget) && !GTK_WIDGET_USER_STYLE (widget);
       
       GTK_WIDGET_UNSET_FLAGS (widget, GTK_RC_STYLE);
       GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
@@ -6343,7 +6362,7 @@ gtk_widget_ensure_style (GtkWidget *widget)
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   if (!GTK_WIDGET_USER_STYLE (widget) &&
-      !GTK_WIDGET_RC_STYLE (widget))
+      !gtk_widget_has_rc_style (widget))
     gtk_widget_reset_rc_style (widget);
 }
 
@@ -6356,7 +6375,7 @@ gtk_widget_reset_rc_style (GtkWidget *widget)
   GtkStyle *new_style = NULL;
   gboolean initial_emission;
   
-  initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
+  initial_emission = !gtk_widget_has_rc_style (widget) && !GTK_WIDGET_USER_STYLE (widget);
 
   GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
   GTK_WIDGET_SET_FLAGS (widget, GTK_RC_STYLE);
@@ -6425,7 +6444,7 @@ gtk_widget_modify_style (GtkWidget      *widget,
    * modifier style and the only reference was our own.
    */
   
-  if (GTK_WIDGET_RC_STYLE (widget))
+  if (gtk_widget_has_rc_style (widget))
     gtk_widget_reset_rc_style (widget);
 }
 
@@ -6964,7 +6983,7 @@ _gtk_widget_propagate_screen_changed (GtkWidget    *widget,
 static void
 reset_rc_styles_recurse (GtkWidget *widget, gpointer data)
 {
-  if (GTK_WIDGET_RC_STYLE (widget))
+  if (gtk_widget_has_rc_style (widget))
     gtk_widget_reset_rc_style (widget);
   
   if (GTK_IS_CONTAINER (widget))
index f88825fa8e344af850c5bcfe6090370215fce94e..02f4ceac8f77d29bf320da2e832d074c176e0fa9 100644 (file)
@@ -332,14 +332,19 @@ typedef enum
 #define GTK_WIDGET_HAS_GRAB(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
 #endif
 
+#ifndef GTK_DISABLE_DEPRECATED
 /**
  * GTK_WIDGET_RC_STYLE:
  * @wid: a #GtkWidget.
  *
  * Evaluates to %TRUE if the widget's style has been looked up through the rc
  * mechanism.
+ *
+ * Deprecated: 2.20: Use gtk_widget_has_rc_style() instead.
  */
 #define GTK_WIDGET_RC_STYLE(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
+#endif
+
 #ifndef GTK_DISABLE_DEPRECATED
 /**
  * GTK_WIDGET_COMPOSITE_CHILD:
@@ -1058,6 +1063,7 @@ gboolean     gtk_widget_hide_on_delete    (GtkWidget      *widget);
 
 /* Widget styles.
  */
+gboolean    gtk_widget_has_rc_style       (GtkWidget           *widget);
 void      gtk_widget_set_style         (GtkWidget      *widget,
                                         GtkStyle       *style);
 void      gtk_widget_ensure_style      (GtkWidget      *widget);